package com.misc.pebblewatch;

import android.content.Context;
import android.content.Intent;

import org.json.JSONArray;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

public class PebbleIntents {

    public static void sendAlertToPebble(Context inContext, String inTitle, String inBody) {
        final Intent i = new Intent("com.getpebble.action.SEND_NOTIFICATION");

        final Map data = new HashMap();
        data.put("title", inTitle);
        data.put("body", inBody);
        final JSONObject jsonData = new JSONObject(data);
        final String notificationData = new JSONArray().put(jsonData).toString();

        i.putExtra("messageType", "PEBBLE_ALERT");
        i.putExtra("sender", "CameraCornet");
        i.putExtra("notificationData", notificationData);

        android.util.Log.i("PebbleTo", "About to send a modal alert to Pebble: " + notificationData);
        inContext.sendBroadcast(i);
    }
}
